# Author:	gong_libin
# Date:		2016_06_01

CC ?= g++
CFLAGS ?= -g -Wall

GLB_ENV ?= $(shell pwd)/..
GLB_BIN ?= $(GLB_ENV)/bin
GLB_INC ?= $(GLB_ENV)/inc
GLB_LIB ?= $(GLB_ENV)/lib

SYS_LIB ?= /usr/lib

GLBPCAP = GlbPcap

TARGETS =				\
	$(GLBPCAP)

OBJEGLBS =				\
	$(GLBPCAP).o

all: $(TARGETS) install

$(OBJEGLBS): %.o: %.cpp
	$(CC) -c $(CFLAGS) -I$(GLB_INC) $< -o $@

$(TARGETS): %: %.o
	$(CC) $(CFLAGS) $< -o $@ -lglbglobal -lpthread -lpcap -ldl

install:
	cp $(TARGETS) $(GLB_BIN)

clean:
	rm -rf $(OBJEGLBS)
	rm -rf $(TARGETS)
